package cn.livingCloud.entity.user;

import cn.livingCloud.context.BeanProvider;
import cn.livingCloud.repository.UserMapper;
import cn.livingCloud.utils.UuidGenerator;

public class AccountPrivilege {

    private transient UserMapper userMapper = BeanProvider.getBean(UserMapper.class);

    private String uuid = UuidGenerator.generate();
    private String userAccountId;

    private Privilege privilege;

    public String getUuid() {
        return uuid;
    }

    public AccountPrivilege setUuid(String uuid) {
        this.uuid = uuid;
        return this;
    }

    public String getUserAccountId() {
        return userAccountId;
    }

    public AccountPrivilege setUserAccountId(String userAccountId) {
        this.userAccountId = userAccountId;
        return this;
    }

    public Privilege getPrivilege() {
        return privilege;
    }

    public AccountPrivilege setPrivilege(Privilege privilege) {
        this.privilege = privilege;
        return this;
    }

    public String getRoleAsString() {
        return "";
    }

    public String getPermissionAsString() {
        return privilege.getPermissionAsString();
    }

    public AccountPrivilege save() {
        userMapper.saveAccountPrivilege(this);
        return this;
    }
}
